import type { OperateFunction } from "yam-types"
import type { RedisConfig } from "../types"
// import { installOrUpgradeChart } from '@yam-plugin/helm-operator/handlers/helm'
import type { HelmReleaseConfig } from "../../helm-operator/types"

const redisProvisioner: OperateFunction<RedisConfig> = async (plan, diff, settings) => {
  if (!diff.hasDiff) {
    return
  }
  
  const releaseConf: HelmReleaseConfig = {
    type: "helm",
    name: "todo",
  }

  // await installOrUpgradeChart(plan, releaseConf, false, settings)

  diff.deletedItems.forEach(r => {
    plan.log.warn(`removing redis service is not allowed, please run 'helm uninstall ${r.name}' command manually`)
  })
}

export default redisProvisioner